home *** CD-ROM | disk | FTP | other *** search
/ MacFormat 2000 July / macformat-092.iso / Fireworks 3 / Settings / Commands / Creative / Create Picture Frame.jsf < prev   
Encoding:
Text File  |  1999-11-19  |  2.5 KB  |  95 lines

  1. // Copyright (c) 1999 Macromedia. All rights reserved.
  2.  
  3. // Ask for the picture-frame size
  4. var newPictureFrame = prompt("Enter the width of picture frame in pixels:","25");
  5. if (newPictureFrame != null && newPictureFrame > 0)
  6. {
  7.     // Figure out the new canvas size
  8.     var leftSide = fw.getDocumentDOM().left - newPictureFrame;
  9.     var topSide = fw.getDocumentDOM().top - newPictureFrame;
  10.     var rightSide = leftSide + fw.getDocumentDOM().width + newPictureFrame*2;
  11.     var bottomSide = topSide + fw.getDocumentDOM().height + newPictureFrame*2;
  12.  
  13.     // Resize the canvas
  14.     fw.getDocumentDOM().setDocumentCanvasSize({left:leftSide, top:topSide, right:rightSide, bottom:bottomSide});
  15.  
  16.     // New layer for frame
  17.     fw.getDocumentDOM().addNewLayer("Picture Frame", true);
  18.  
  19.     // Draw the new outer frame
  20.     fw.getDocumentDOM().addNewRectangle({left:leftSide, top:topSide, right:rightSide, bottom:bottomSide}, 0);
  21.     var outerFrame = fw.selection[0];
  22.  
  23.     // Draw the new inner frame, inset from the outer frame by the newPictureFrame width
  24.     fw.getDocumentDOM().addNewRectangle({left:leftSide + newPictureFrame, top:topSide + newPictureFrame, right:rightSide - newPictureFrame, bottom:bottomSide - newPictureFrame}, 0);
  25.     var innerFrame = fw.selection[0];
  26.  
  27.     // make the new elems selected
  28.     var newSel = [ innerFrame, outerFrame ];
  29.     fw.selection = newSel;
  30.  
  31.     // punch the new frame
  32.     fw.getDocumentDOM().pathPunch();
  33.  
  34.     // make sure we have no default brush applied
  35.     fw.getDocumentDOM().removeBrush();
  36.  
  37.     // Add the fill
  38.     fw.getDocumentDOM().setFillNColorNTexture(
  39.         {
  40.             category:"fc_Pattern",
  41.             ditherColors:[ "#000000", "#000000" ],
  42.             edgeType:"antialiased",
  43.             feather:0,
  44.             gradient:null,
  45.             name:"fn_Normal",
  46.             pattern:{ image:null, name:"Wood-Light" },
  47.             shape:"pattern",
  48.             stampingMode:"blend",
  49.             textureBlend:0,
  50.             webDitherTransparent:false
  51.         },
  52.         "#ffedf8",
  53.         "Grain"
  54.     );
  55.  
  56.     // Add the effects
  57.     fw.getDocumentDOM().applyEffects(
  58.         {
  59.             category:"Untitled",
  60.             effects:[
  61.                 {
  62.                     AngleSoftness:3,
  63.                     BevelContrast:75,
  64.                     BevelType:0,
  65.                     BevelWidth:7,
  66.                     ButtonState:0,
  67.                     DownBlendColor:"#0000003f",
  68.                     EdgeThreshold:0,
  69.                     EffectIsVisible:true,
  70.                     EffectMoaID:"{7fe61102-6ce2-11d1-8c76000502701850}",
  71.                     EmbossFaceColor:"#ffffff00",
  72.                     GlowStartDistance:0,
  73.                     GlowWidth:0,
  74.                     HiliteColor:"#ffffff",
  75.                     HitBlendColor:"#ffffff3f",
  76.                     LightAngle:135,
  77.                     LightDistance:100,
  78.                     MaskSoftness:0,
  79.                     OuterBevelColor:"#df0000",
  80.                     ShadowColor:"#000000",
  81.                     SlopeMultiplier:1,
  82.                     SlopeType:3,
  83.                     category:"Inner Bevel",
  84.                     name:"Inner Bevel"
  85.                 }
  86.             ],
  87.             name:"Untitled"
  88.         }
  89.     );
  90.  
  91. }
  92.  
  93.  
  94.  
  95.